<?php
namespace App\Http\Query;

use Illuminate\Support\Facades\DB;

/*
 * セール品
 */
class GoodsDetailQuery
{

    // 商品詳細取得
    public function getGoodsDetail($goodsId)
    {
        $sql = 'select goods_id, goods_name, price, new_flg from goods_master where delete_flg = 0 and goods_id = ? order by updated_at desc';
        $param = [
            $goodsId
        ];
        $goodsDetail = DB::select($sql, $param);
        return $goodsDetail;
    }

    // 商品画像取得
    public function getGoodsImage($goodsId)
    {
        $sql = 'select goods_id, image_id, image_url,file_name from goods_picture where delete_flg = 0 and goods_id = ? order by updated_at desc';
        $param = [
            $goodsId
        ];
        $goodsImage = DB::select($sql, $param);
        return $goodsImage;
    }
}